﻿@model ECatalog.Models.Kit[]

@{
    ViewBag.Title = "Комплекты";
    Layout = "../Shared/_Layout.cshtml";
}
<div class="container">
    <div class="row">
        @using (@Html.BeginForm("AddKit", "Kit", FormMethod.Post))
        {            
            <p>
                <button type="submit" class="btn btn-primary">Добавить комплект</button>
            </p> 
        }
    </div>
    <div class="row">
        <table class="table table-bordered table-hover">
            <thead>
                <tr>
                    <th>UID</th>
                    <th>Фотография</th>
                    <th>Описание</th>
                    <th>Действия</th>
                </tr>
            </thead>
            <tbody>
                @if (Model != null && Model.Length > 0)
                {
                    foreach (var item in Model)
                    {
                    <tr>
                        <td>@item.KitId</td>
                        <td>@{ 
                        var imageUrl = string.Format("/Files/Organization-{0}/Kit-{1}/{2}/320x240/{3}{4}", @item.OrganizationId, @item.KitId, @item.ImageUrl, @item.ImageUrl,@item.TypeImage);
                        }
                            <img src="@imageUrl" width="200" />
                        </td>
                        <td>@item.Description</td>
                        <td>@using (@Html.BeginForm("EditKit", "Kit", new { kitId = @item.KitId }, FormMethod.Post))
                            {
                            <button type="submit" class="btn btn-link">Редактировать</button>
                            }
                            @using (@Html.BeginForm("DeleteKit", "Kit", new { kitId = @item.KitId }, FormMethod.Post))
                            {
                                <button type="submit" class="btn btn-link">Удалать</button>
                            }
                        </td>
                    </tr>
                    }
                }
            </tbody>
        </table>
    </div>
</div>

